<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>领用物品清单</title><!-- 收件箱 -->
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <script src="/js/jquery/jquery-1.9.1.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <style>
        body,html{
            width: 100%;
        }
        *{
            padding: 0;
            margin: 0;
        }
        .page{
            width: 100%;
            height: 100%;
        }
        table{
            width: 90%;
            margin: 10px auto;
        }
        table tr{
            border: #ccc 1px solid;
        }
        table tr th{
            padding: 10px;
            text-align: center;
            color: #2F5C8F;
            font-size: 13pt;
            font-weight: bold;
        }
        table tr td{
            padding: 10px;
            text-align: center;
            font-size: 11pt;
        }
    </style>
</head>
<body>
<div class="page">
    <table cellspacing="0" cellpadding="0" style="border-collapse:collapse;">
        <thead>
            <tr>
                <th>物品名称</th>
                <th>数量</th>
                <th>单位</th>
                <th>状态</th>
                <th>日期</th>
            </tr>
        </thead>
        <tbody class="trList">

        </tbody>
    </table>
</div>

<script type="text/javascript">
    $(function () {
        var staffId=$.getQueryString('userId');

        $.ajax({
            type:'get',
            url:'/hr/api/getTranshistoryById',
            dataType:'json',
            data:{
                borrower:staffId
            },
            success:function (res) {
                var str='';
                var datas=res.obj;
                for(var i=0;i<datas.length;i++){
                    var statusName='';
                    if(datas[i].returnStatus=='0'){
                        statusName='借用';
                    }else if(datas[i].returnStatus=='1'){
                        statusName='领用';
                    }
                    str+='<tr>'
                        +'<td>'+datas[i].proName+'</td>'
                        +'<td>'+datas[i].transQty+'</td>'
                        +'<td>'+datas[i].proUnit+'</td>'
                        +'<td>'+statusName+'</td>'
                        +'<td>'+datas[i].transDate+'</td>'
                        +'</tr>';
                }
                    $(".trList").html(str);
                }
        })
    })
</script>
</body>
</html>